<#assign dialogId = nowTimestamp.getTime()/>

<div id="${dialogId}" title="${uiLabelMap.RestaurantAddUser}">
  <p id="errorMessage${dialogId}" class="error-message"></p>
  <form name="AddUser" action="<@ofbizUrl>addUser</@ofbizUrl>" method="post">
    <table class="basic-table" cellspacing="0">
          <tbody>
          <tr>
            <td class="label">${uiLabelMap.RestaurantFirstName}</td>
            <td><input type="text" name="firstName" value="" class="text ui-widget-content ui-corner-all"></td>
          </tr>
          <tr>
            <td class="label">${uiLabelMap.RestaurantLastName}</td>
            <td><input type="text" name="lastName" value="" class="text ui-widget-content ui-corner-all"></td>
          </tr>
          <tr>
            <td class="label">${uiLabelMap.RestaurantType}</td>
            <td>
                <select name="roleTypeId">
                    <#list roleTypes as roleType>
                    <option value="${roleType.roleTypeId}">${roleType.description}</option>
                    </#list>
                </select>
            </td>
          </tr>
          <tr>
            <td class="label">${uiLabelMap.RestaurantUser}</td>
            <td><input type="text" name="userLoginId" value="" class="text ui-widget-content ui-corner-all"></td>
          </tr>
          <tr>
            <td class="label">${uiLabelMap.RestaurantPassword}</td>
            <td><input type="password" name="currentPassword" value="" class="text ui-widget-content ui-corner-all"></td>
          </tr>
          <tr>
            <td class="label">${uiLabelMap.RestaurantConfirmPassword}</td>
            <td><input type="password" name="currentPasswordVerify" value="" class="text ui-widget-content ui-corner-all"></td>
          </tr>
          <tr>
            <td></td>
            <td><input type="submit" tabindex="-1" style="position:absolute; top:-1000px"></td>
          </tr>
        </tbody>
    </table>
  </form>
</div>
<script>
    function addUser () {
        submitDialogForm("${dialogId}", document.AddUser)
        return false;
    }
    dialog${dialogId} = $( "#${dialogId}" ).dialog({
      autoOpen: false,
      height: 400,
      width: 500,
      modal: true,
      buttons: {
        "${StringUtil.wrapString(uiLabelMap.RestaurantSave)}": addUser,
        "${StringUtil.wrapString(uiLabelMap.RestaurantCancel)}": function() {
          dialog${dialogId}.dialog( "close" );
        }
      },
      close: function() {
        document.AddUser.reset();
      }
    });
    
    $("#NewUser").button().on( "click", function() {
        dialog${dialogId}.dialog( "open" );
    });
  </script>